import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
/***
 * 测试修改
 * */
public class test {
    public static void main(String[] args) throws Exception{
        Class.forName("com.mysql.cj.jdbc.Driver");
        String username = "root";
        String password = "123456";
        String url = "jdbc:mysql://localhost:3306/shujia";
        Connection connection = DriverManager.getConnection(url, username, password);
        String sql = "select * from student where id = ?";
        PreparedStatement ps = connection.prepareStatement(sql);
        ps.setString(1,"1001");
        ResultSet resultSet = ps.executeQuery();

        if (resultSet.next()) {
            System.out.println("登录成功");
            System.out.println(resultSet.getString("id")+"---"+resultSet.getString("name"));
        }else {
            System.out.println("登录失败");
        }
    }
}
